#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    // 把两个输入框设置为密码模式
    ui->lineEdit_input->setEchoMode(QLineEdit::Password);
    ui->lineEdit_enabel->setEchoMode(QLineEdit::Password);
    ui->label->setText("密码为空");
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    QString input = ui->lineEdit_input->text();
    QString enabel = ui->lineEdit_enabel->text();
    if(input.isEmpty() && enabel.isEmpty())
    {
        ui->label->setText("密码为空");
    }
    else if(input != enabel)
    {
        ui->label->setText("密码错误");
    }
    else
    {
        ui->label->setText("密码正确");
    }
}

